/*     */ package com.yntsoft.mybatisUtil;
/*     */ 
/*     */ import java.util.regex.Matcher;
/*     */ import java.util.regex.Pattern;
/*     */ 
/*     */ public class StringTools
/*     */ {
/*  72 */   private static Pattern pattern = Pattern.compile("([\\p{Punct}&&[^\\$\\\\]])");
/*     */ 
/*     */   public static boolean isEmptyString(String value)
/*     */   {
/*  24 */     return (value == null) || ("".equals(value.trim()));
/*     */   }
/*     */ 
/*     */   public static boolean isNotEmptyString(String value)
/*     */   {
/*  35 */     return (value != null) && (!"".equals(value.trim()));
/*     */   }
/*     */ 
/*     */   public static String addZeroForNum(String str, int strLength)
/*     */   {
/*  48 */     int strLen = str.length();
/*  49 */     if (strLen < strLength) {
/*  50 */       while (strLen < strLength) {
/*  51 */         StringBuffer sb = new StringBuffer();
/*  52 */         sb.append("0").append(str);
/*  53 */         str = sb.toString();
/*  54 */         strLen = str.length();
/*     */       }
/*     */     }
/*  57 */     return str;
/*     */   }
/*     */ 
/*     */   public static String null2Str(String str)
/*     */   {
/*  67 */     if (null == str)
/*  68 */       return "";
/*  69 */     return str;
/*     */   }
/*     */ 
/*     */   public static String escapeRegex(String original)
/*     */   {
/*  76 */     Matcher matcher = pattern.matcher(escapeDollarBackslash(original));
/*  77 */     StringBuffer buffer = new StringBuffer();
/*  78 */     while (matcher.find()) {
/*  79 */       String group = matcher.group();
/*  80 */       matcher.appendReplacement(buffer, "\\\\" + group);
/*     */     }
/*  82 */     matcher.appendTail(buffer);
/*  83 */     return buffer.toString();
/*     */   }
/*     */ 
/*     */   public static String escapeDollarBackslash(String original) {
/*  87 */     if (null == original)
/*  88 */       return "";
/*  89 */     StringBuffer buffer = new StringBuffer(original.length());
/*  90 */     for (int i = 0; i < original.length(); i++) {
/*  91 */       char c = original.charAt(i);
/*  92 */       if ((c == '\\') || (c == '$'))
/*  93 */         buffer.append("\\").append(c);
/*     */       else {
/*  95 */         buffer.append(c);
/*     */       }
/*     */     }
/*  98 */     return buffer.toString();
/*     */   }
/*     */ 
/*     */   public static String legalString(String illegalChar, String str)
/*     */   {
/* 111 */     for (int i = 0; i < illegalChar.length(); i++) {
/* 112 */       if (str.indexOf(illegalChar.charAt(i)) != -1)
/*     */       {
/* 114 */         str = str.replace(String.valueOf(illegalChar.charAt(i)), "");
/*     */       }
/*     */     }
/* 117 */     return str;
/*     */   }
/*     */ 
/*     */   public static String legalFileName(String fileName)
/*     */   {
/* 127 */     String illegalChar = "\\/:*?<>|\"";
/* 128 */     return legalString(illegalChar, fileName);
/*     */   }
/*     */ }

/* Location:           C:\Users\Tony\Desktop\webbas-components-core-2.0-SNAPSHOT.jar
 * Qualified Name:     com.aspire.webbas.core.util.StringTools
 * JD-Core Version:    0.6.2
 */